package net.yuyoo.testing;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import net.yuyoo.uusession.UUSessionServer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.danga.MemCached.MemCachedClient;

public class Demo {

	private static final Log log = LogFactory.getLog(Demo.class); 
	/**
	 * @param args
	 */
	public static void main(String[] args) { 
		
		//testString();
		//testMaxInt();
		//testUUSessionServer();
		testUnixTime();
	}
	
	public static void testString() {
		
		StringBuffer sb = new StringBuffer();
		sb.append("zhandl");
		sb.setLength(0);
		
		log.debug(sb.toString());
		log.debug(sb.length());
		
		sb.append("bingo");
		
		log.debug(sb.toString());
		log.debug(sb.length());
		
	}
	
	public static void testMaxInt() {
		log.debug(Integer.MAX_VALUE);
	}


	
	public static void testUUSessionServer() {

		UUSessionServer s = UUSessionServer.getInstance("yuyoo");
		MemCachedClient mc = s.getMemCachedClient();
		log.error("ssssssssssssss:" + mc.get("638162332"));
		mc.set("82222", "fucking.demo");
		log.error("wwwwwwwwwwwwww:" + mc.get("638162332"));
	}
	
	public static void testUnixTime() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		try {
			Date d1970 = sdf.parse("19700101");
			

			System.out.println(Long.toString(d1970.getTime()));
			long newDate = d1970.getTime() +  1232512048000L;
			Date d = new Date(newDate);
 
			System.out.println(newDate);
			System.out.println(d.toLocaleString());
			System.out.println(d);
		} catch (Exception e) { 
			e.printStackTrace();
		}
	}
}
